<?php
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}

$fromversion = $_GET['fromversion'];

if($fromversion < 1.1) {
	$config = DB::table('er_gridad_config');

	$configs = [
		['credit_recharge_url', '积分充值链接', '', '用户积分不足时的充值链接'],
		['credit_type', '积分类型', '2', '用于广告支付的积分类型'],
    ];

	foreach($configs as $item) {
		if(!DB::fetch_first("SELECT * FROM {$config} WHERE `key`='{$item[0]}'")) {
			runquery("INSERT INTO {$config} (`key`, name, value, `desc`) VALUES ('{$item[0]}', '{$item[1]}', '{$item[2]}', '{$item[3]}')");	
		}
	}
}

$finish = TRUE;